//CommRow.js  由行对象决定有多少行数 tr 还是放在这里 一行当中 确定有多少列
import React, {Component} from 'react';
import CommCellView from './commCellView';

import RowTableHeadView from './rowTableHeadView';
export default class CommRowView extends Component {

    constructor(props) {
        super(props);
    this.state = {
        executeFormula:props.executeFormula
       };
    }


    getCommCell(rowNo,colNo,commDataVal,commValue,cell_struct_model,
                commAlign,commborder_top,commborder_bottom,commborder_left,commborder_right,
                commaddFilter_bright,commcellBackgroundColor,commcell_font_cssArray,commCell_editing_mode) {
        return <CommCellView
            rowNo={rowNo}
            colNo={colNo}
            commData={commDataVal}
            commValue={commValue}
            cell_struct_model={cell_struct_model}
            commAlign={commAlign}
            commborder_top={commborder_top}
            commborder_bottom={commborder_bottom}
            commborder_left={commborder_left}
            commborder_right={commborder_right}
            commaddFilter_bright={commaddFilter_bright}
            commcellBackgroundColor={commcellBackgroundColor}
            commcell_font_cssArray={commcell_font_cssArray}
            commCell_editing_mode={commCell_editing_mode}
            key={"CommCell"+rowNo+"_"+colNo}
            executeFormula={this.state.executeFormula}
        />
    }

    render() {

        let c = this.props.colNum;  //列数
        let rowNo = this.props.rowNo;  //行号
        let cells = [];


        //for (var j = 0; j < c; j++) {
        for (var j = 1; j < c; j++) {
            let commData=this.props.rowData[j]|| '';
            let commValue=this.props.rowValue[j]|| '';
            let cell_struct_model=this.props.row_struct_model[j];
            let commAlign=this.props.rowAligns[j]|| 1;
            let commborder_top=this.props.rowborder_tops[j]|| '';
            let commborder_bottom=this.props.rowborder_bottoms[j]|| '';
            let commborder_left=this.props.rowborder_lefts[j]|| '';
            let commborder_right=this.props.rowborder_rights[j]|| '';
            let commaddFilter_bright=this.props.rowaddFilter_brights[j]|| '';
            let commcellBackgroundColor=this.props.rowcellBackgroundColors[j]|| '';
            let commcell_font_cssArray=this.props.rowcell_font_cssArray[j]|| '';
            let commCell_editing_mode=this.props.rowCell_editing_mode[j]|| '';
                cells.push(this.getCommCell(rowNo,j,
                    commData,commValue,cell_struct_model,commAlign,commborder_top,commborder_bottom,commborder_left,commborder_right,
                    commaddFilter_bright,commcellBackgroundColor,commcell_font_cssArray,commCell_editing_mode));
        }

        return (
            <tr key={"rowNo_"+rowNo} className="ttrViewttrView">
                <RowTableHeadView
                    rowNo={rowNo}
                    rowHeight={this.props.rowHeight}

                />{cells}</tr>
        )
    }
}
